package com.culturaltourism.admin.controller;

import com.culturaltourism.admin.pojo.SysDictData;
import com.culturaltourism.admin.service.SysDictDataService;
import com.culturaltourism.core.controller.BaseController;
import com.culturaltourism.core.dto.Result;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @ClassName SysDictDataController
 * @Description 字典数据接口
 * @Author MaShuai
 * @Date 2019/5/9 17:20
 * @Version 1.0
 **/
@Controller
@RequestMapping(value = "/sysDictData")
public class SysDictDataController extends BaseController {

    private static Logger logger = LoggerFactory.getLogger(SysDictDataController.class);

    @Autowired
    private SysDictDataService sysDictDataService;

    @GetMapping()
    public String dictData() {
        String prefix = "system/dict/data";
        return prefix + "/data";
    }

    @RequestMapping("/list")
    @RequiresPermissions("system:dict:list")
    @ResponseBody
    public Result list(Integer page, Integer limit) {
        //startPage();
        List<SysDictData> list = sysDictDataService.selectDictDataList(page, limit);
        return Result.success(list);
    }

}
